All Questions
Tagged with programming-languagescompiler
64 questions
0votes
1answer
489views
How do function inlining and Tail Call Optimization affect call stack?
I've just accidentally came across this answer about inlined functions and I'd like to know how this affects call stack. But I can't add comments because I don't have enough rep so I decided to ask ...
0votes
1answer
235views
Is it true that variable type before name makes compiler work easier? [closed]
I have seen information that at least one of reasons why type placed before variable name is that it allows compiler easier evaluate size and type of variable. If so then how (what way) it eases this ...
0votes
1answer
148views
Are indirect implicit type declerations dangerous?
In the case of kotlin, rust and many other programming languages... There are variables with direct implicit type declarations... Where you can see the type of a variable at the same line where it's ...
13votes
8answers
6kviews
How do compilers work in a language that doesn't allow recursion?
I'm recently learning the programming language, and I wonder how compilers work when the language itself does not allow recursion, like how the compiler or the runtime checkers makes sure that there ...
1vote
2answers
790views
Is there a simple algorithm for generating unit tests given a function's code? [closed]
Given the abstract syntax tree (AST) of each line of a function's code, I am asked to generate code for that function's corresponding unit tests, similar to what Microsoft's IntelliTest tool does here:...
0votes
3answers
935views
Is it possible to make a compiler for any dynamic/script/interpreter language
Logically, not based on how cost we will spend or how much we will hire programmers to do it. Can we (Is it possible to) make a compiler for any dynamic/script/interpreter language, like Lua, Python, ...
0votes
1answer
385views
Benefits of using a tokenizer/lexer before parsing for recusive descent parser
I am trying to build a static program analyzer for a proprietary progamming language for a school project, and am currently trying to implement the parser from scratch. I was wondering, what are the ...
2votes
4answers
239views
A language design with variable qualifier
I am planning to design a programming language. One challenge I face with is whether it is a good idea to have const as a variable qualifier instead of a type qualifier. For example in C++: const int ...
-1votes
3answers
4kviews
Is it really always easier to write an interpreter than a compiler?
I've read that generally it's easier to write an interpreter than a compiler. If that's true, what's the reason? Writing an interpreter seems to me equivalent in the level of difficulty as writing a ...
0votes
2answers
4kviews
Understanding Context Free Grammar using a simple C code
I'm trying to understand the difference between terminal and non-terminal values in a real language. I wasn't able to find enough examples on real language CFGs on the internet, most examples are ...
-1votes
1answer
207views
What is the minimum set of operations a language implementation must provide for it to be usable for all applications?
As a fun hobby project, I'm writing a simple bytecode VM and a compiler from a basic high-level language to the said bytecode. (Offtopic: the compiler is inspired by Jack Crenshaw's awesome tutorial -...
8votes
2answers
684views
Only one number type in language design
I am currently learning about compiler construction and language design and I am thinking about what native datatypes I want to support in my language. Now there is a whole lot of languages that make ...
18votes
1answer
4kviews
Why does LLVM have an assembly-like IR rather than a tree-like IR? Or: why do projects target LLVM IR instead of clang's AST?
Why is LLVM's intermediate representation (LLVM IR) assembly-like rather than tree-like? Alternatively, why do language implementations target LLVM IR rather than clang's AST? I'm not trying to ask ...
60votes
14answers
14kviews
Can we make general statements about the performance of interpreted code vs compiled code?
I'm comparing two technologies in order to reach a recommendation for which one should be used by a company. Technology A's code is interpreted while technology B's code is compiled to machine code. ...
0votes
2answers
246views
Where to start when creating a programming language? [closed]
I'm actually a programmer on a few languages, but I realized I really didn't know much how the computer works on a deeper level. So I thought a good idea to discover and learn how does it work was to ...